/*
 *  Atom.cpp
 *  CompoundParser
 *
 *  Created by Ryan Edwards-Crewe on 09-01-10.
 *  Copyright 2010 RECCoder. All rights reserved.
 *
 */

#include "Atom.h"

Atom::Atom() {}

Atom::~Atom() {}

int Atom::setAtomData(char& ch, FILE* fptr) {
	
	int chk = fscanf(fptr, "%d%s%f%f%f%s%d%s%f", 
					 &ATOM_ID,
					 _ATOM,
					 &X_COORD,
					 &Y_COORD,
					 &Z_COORD,
					 ATOM_TYPE,
					 &SUBSTRUCTURE_ID,
					 SUBSTRUCTURE_NAME,
					 &CHARGE);
	
	if (chk < 9)
		return -1;
	else 
		return 0;
}

void Atom::writeAtomData(int cid, FILE* of) {
	fprintf(of, "(%d, %d, '%s', %f, %f, %f, '%s', %d, '%s', %f)",
			cid,
			ATOM_ID,
			_ATOM,
			X_COORD,
			Y_COORD,
			Z_COORD,
			ATOM_TYPE,
			SUBSTRUCTURE_ID,
			SUBSTRUCTURE_NAME,
			CHARGE);
}